<?php
/**
 * @author all@cosmos-framework.org
 * @copyright (c) 2013 cosmos-framework.org
 * @license http://www.opensource.org/licenses/mit-license.php
 * @link http://cosmos-framework.org/
 * @package cosmos.framework
 * @version 2.0
 */
namespace Cosmos\Database;

use \Cosmos\Database as Database;

trait Method {

    /**
     * @param string $methodName
     * @param mixed[] $methodArgs
     * @return mixed
     */
    public static function __callStatic($methodName, $methodArgs) {

        $s = str_replace('\\', '/', strtolower(__CLASS__));

        // { component }/{ method }.sql
        $s = sprintf('%s/%s.sql', $s, $methodName);

        // { component }/{ method }.sql
        return Database::requires($s, array_shift($methodArgs));
    }

}
